package org.xinjiang.data.migration.flush.enums;

import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.Getter;

@Getter
public enum AccountStatusEnum {
    NORMAL(1, "正常账户", "STATUS_NORMAL"), FREEZE(2, "冻结", "FREEZE"), UNKNOWN(0, "未知", "UNKNOWN"), DELETE(1, "删除", "STATUS_DELETE");
    private Integer state;

    private String name;

    private String code;

    AccountStatusEnum(Integer state, String name, String code) {
        this.state = state;
        this.name = name;
        this.code = code;
    }

    @JsonCreator
    public static AccountStatusEnum of(String code) {
        for (AccountStatusEnum value : AccountStatusEnum.values()) {
            if (value.code.equals(code)) {
                return value;
            }
        }
        return UNKNOWN;
    }
}
